package model.impl.menu;

import model.EMenuState;
import model.impl.StateListener;

public class MainMenuState extends AbstractMenuState {
	private static final MainMenuState INSTANCE = new MainMenuState();
	private static final int PLAY = 0;
	private static final int SETTINGS = 1;
	private static final int QUIT = 2;
	
	
	private MainMenuState() {
		currentAlternative = 0;
		numberOfAlternatives = 3;
	}
	
	public static MainMenuState getInstance() {
		return INSTANCE;
	}

	@Override
	public void fireAlternative() {
		if (currentAlternative == PLAY) {
			viewCharacterSelection();
		} else if (currentAlternative == SETTINGS) {	
			viewSettings();
		} else if (currentAlternative == QUIT) {
			quit();
		}
	}
	
	private void viewCharacterSelection() {
		for (StateListener listener : listeners) {
			listener.viewCharacterSelection();
		}
	}
	
	private void viewSettings() {
		for (StateListener listener : listeners) {
			listener.viewSettings();
		}
	}
	
	private void quit() {
		for (StateListener listener : listeners) {
			listener.quit();
		}
	}

	//This method is only supposed to be used in the SettingsState
	@Override
	public int getChosenCharacterIndex() {
		return 0;
	}

	//This method is only supposed to be used in the SettingsState
	@Override
	public String getIP() {
		return null;
	}

	//This method is only supposed to be used in the SettingsState
	@Override
	public String getNick() {
		return null;
	}

	//This method is only supposed to be used in the SettingsState
	@Override
	public boolean isFullScreen() {
		return false;
	}

	//This method is only supposed to be used in the SettingsState
	@Override
	public void insertCharacter(char c) {
		
	}

	//This method is only supposed to be used in the SettingsState
	@Override
	public void removeCharacter() {
		
	}

	@Override
	public EMenuState getEMenuState() {
		return EMenuState.MAIN_MENU;
	}

	@Override
	public void moveAlternativeLeft() {
		
	}

	@Override
	public void moveAlternativeRight() {
		
	}
}
